package com.weizai.carshop.model.entiity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.weizai.carshop.model.config.LocalDateTimeConfig;
import io.swagger.v3.core.util.Json;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@TableName(value = "goods_info", autoResultMap = true)
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GoodsInfoEntity {

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    private Long cateId;

    private String title;

    private BigDecimal price;

    private Integer sale;

    private BigDecimal score;

    private Integer stock;

    private String description;

    private String banner;

    @TableField(typeHandler = JacksonTypeHandler.class)
    private GoodsSwipeInfo[] swipeInfo;

    @TableField(typeHandler = JacksonTypeHandler.class)
    private GoodsNorm[] goodsNorms;

    @JsonSerialize(using = LocalDateTimeConfig.LocalDateTimeSerializer.class)
    private LocalDateTime createTime;

    @JsonSerialize(using = LocalDateTimeConfig.LocalDateTimeSerializer.class)
    private LocalDateTime updateTime;
}
